<?php use_stylesheet('teams.css') ?>
<?php slot('title', sprintf('.:: Pronos ::. Liste des pronostics Phase 1'))
?>
<h1>Editer Pronostics P1</h1>
<style>

.button{
	color: #62290A;
	text-align: center;
	width: auto;
}

.field {
	border: none;
	border: 1px solid #E25F17;
	color: #62290A;
	width: 30px;
	text-align: center;
}

</style>
<div id="teams">
<form method="post" action="/pronos/frontend_dev.php/p1pronos">

<table class="teams">
  <thead>
    <tr>
      <th>Id</th>
      <th>Date</th>
      <th colspan="2">Team1</th>
	  <th colspan="3">Score</th>
      <th colspan="2">Team2</th>
      <!--th>Updated at</th-->
    </tr>
  </thead>
  <tbody>
    <?php
	foreach ($matchs_date as $i => $pronos_match):
			$result = $pronos_match->getP1Result();	
			$pronos = $pronos_match->getPronosForUser($sf_user);
			if($pronos) {
				$score1 = $pronos->getScore1();
				$score2 = $pronos->getScore2();
			} else {
				$score1 = "";
				$score2 = "";
			}
	?>
    <tr class="<?php echo fmod($i, 2) ? 'even' : 'odd' ?>">
		<input type="hidden" value="<?php echo $sf_user->getGuardUser()->getId() ?>" name="pronos_p1_pronos[p1match_id : <?php echo $pronos_match->getId() ?>][user_id]" />
		<input type="hidden" value="<?php echo $pronos_match->getId() ?>" name="pronos_p1_pronos[p1match_id : <?php echo $pronos_match->getId() ?>][p1match_id]" />
		<td><a href="<?php echo url_for('p1match/show?id='.$pronos_match->getId()) ?>"><?php echo $pronos_match->getId() ?></a></td>
		<td class="position"><?php echo $pronos_match->getFDate('d/m H:i') ?></td>
		<td><img src="/pronos/images/teams/<?php echo strtolower($pronos_match->getTeam1()->getCode()) ?>.gif" /></td>
		<td align="right"><?php echo $pronos_match->getTeam1()->getName() ?></td>
		<td align="right"><input type="text" class="field" value="<?php echo $score1 ?>" name="pronos_p1_pronos[p1match_id : <?php echo $pronos_match->getId() ?>][score1]" /></td>
		<td align="center">&nbsp;-&nbsp;</td>
		<td align="left"<input type="text" class="field" value="<?php echo $score2 ?>" name="pronos_p1_pronos[p1match_id : <?php echo $pronos_match->getId() ?>][score2]" /></td>
		<td align="left"><?php echo $pronos_match->getTeam2()->getName() ?></td>
		<td><img src="/pronos/images/teams/<?php echo strtolower($pronos_match->getTeam2()->getCode()) ?>.gif" /></td>
    </tr>
    <?php endforeach; ?>
	<tr><td colspan="9" align="center"><input name="valider" type="submit" class="button" /></td></tr>
  </tbody>
</table>
</form>
</div>